<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <!--如果想在工具栏加入更多按钮，可以使用插槽方式， slot = 'left' or 'right'-->
      <crudOperation :permission="permission" />
      <!--表单组件-->
      <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
        <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
          <el-form-item label="入库量" prop="stockInCount">
            <el-input v-model="form.stockInCount" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="审核人" prop="auditId">
            <el-input v-model="form.auditId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="化学品id" prop="chemiclaId">
            <el-input v-model="form.chemiclaId" style="width: 370px;" />
          </el-form-item>
          <el-form-item label="当前库存量" prop="currentStockCount">
            <el-input v-model="form.currentStockCount" style="width: 370px;" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button type="text" @click="crud.cancelCU">取消</el-button>
          <el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
        </div>
      </el-dialog>
      <!--表格渲染-->
      <!--<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">-->
      <!--<el-table-column type="selection" width="55" />-->
      <!--<el-table-column prop="id" label="主键" />-->
      <!--<el-table-column prop="createBy" label="创建者" />-->
      <!--<el-table-column prop="updateBy" label="更新者" />-->
      <!--<el-table-column prop="createTime" label="创建日期">-->
      <!--<template slot-scope="scope">-->
      <!--<span>{{ parseTime(scope.row.createTime) }}</span>-->
      <!--</template>-->
      <!--</el-table-column>-->
      <!--<el-table-column prop="updateTime" label="更新时间">-->
      <!--<template slot-scope="scope">-->
      <!--<span>{{ parseTime(scope.row.updateTime) }}</span>-->
      <!--</template>-->
      <!--</el-table-column>-->
      <!--<el-table-column prop="stockInCount" label="入库量" />-->
      <!--<el-table-column prop="auditId" label="审核人" />-->
      <!--<el-table-column prop="chemiclaId" label="化学品id" />-->
      <!--<el-table-column prop="currentStockCount" label="当前库存量" />-->
      <!--<el-table-column v-permission="['admin','chemiclaStockIn:edit','chemiclaStockIn:del']" label="操作" width="150px" align="center">-->
      <!--<template slot-scope="scope">-->
      <!--<udOperation-->
      <!--:data="scope.row"-->
      <!--:permission="permission"-->
      <!--/>-->
      <!--</template>-->
      <!--</el-table-column>-->
      <!--</el-table>-->
      <!--&lt;!&ndash;分页组件&ndash;&gt;-->
      <!--<pagination />-->
    </div>
  </div>
</template>

<script>
import crudChemiclaStockIn from '@/api/psp/chemicla/chemiclaStockIn'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'

const defaultForm = { id: null, createBy: null, updateBy: null, createTime: null, updateTime: null, stockInCount: null, auditId: null, chemiclaId: null, currentStockCount: null }
export default {
  name: 'ChemiclaStockIn',
  components: { pagination, crudOperation, rrOperation, udOperation },
  mixins: [presenter(), header(), form(defaultForm), crud()],
  cruds() {
    return CRUD({ title: '化学品入库管理', url: 'api/chemiclaStockIn', sort: 'id,desc', crudMethod: { ...crudChemiclaStockIn }})
  },
  data() {
    return {
      permission: {
        add: ['admin', 'chemiclaStockIn:add'],
        edit: ['admin', 'chemiclaStockIn:edit'],
        del: ['admin', 'chemiclaStockIn:del']
      },
      rules: {
        stockInCount: [
          { required: true, message: '入库量不能为空', trigger: 'blur' }
        ],
        auditId: [
          { required: true, message: '审核人不能为空', trigger: 'blur' }
        ],
        chemiclaId: [
          { required: true, message: '化学品id不能为空', trigger: 'blur' }
        ],
        currentStockCount: [
          { required: true, message: '当前库存量不能为空', trigger: 'blur' }
        ]
      }}
  },
  methods: {
    // 获取数据前设置好接口地址
    [CRUD.HOOK.beforeRefresh]() {
      return true
    }
  }
}
</script>

<style scoped>

</style>
